home *** CD-ROM | disk | FTP | other *** search
- > Wimp.Install
-
- New Calls
- ---------
-
- *Obey
- *WimpSlot
-
-
- Installation of applications
- ----------------------------
-
- One of the most annoying problems associated with using application software
- on floppy disc is that it can be extremely inconvenient, if not impossible,
- to transfer the software onto a hard disc, without rewriting the boot code.
-
- With regard to this problem, it is extremely useful if application software
- can find out where its resource files are, without having to have the
- directory names 'hard-wired' in, and without having to rely on the position
- of the 'current directory'.
-
- The best way to achieve this is to put all the application software and
- associated data files into a single directory, including one file which is
- used to start the whole thing up. When this file is run, it finds out where
- it has been run from, and the application continues by assuming that the rest
- of the files are contained within the same directory as the initial file. In
- this way the whole application can be installed onto a hard disc (or network,
- or whatever) simply by copying the entire directory across.
-
- Several features have been further built into Arthur 2.00 to make this
- approach work:
-
- * *Run <directory> attempts to run <directory>.!Run
- * the *Obey command allows easy access to the path name
- the environment variable <Obey$Dir> is set to the parent dirname
- * the *WimpSlot command allows application memory to be manipulated
- * the path name can be held in an environment variable for later use
- * the Finder recognises directory-names starting with "-":
- - double-clicking on the directory causes it to be *Run
- this actually runs <Directory>.!Run
- - <Directory>.!Boot is run when the parent dir is displayed
- (this helps with setting up datafile filetypes)
- - the boot file can cause a sprite file to be loaded (*IconSprites)
- the dir is displayed as a sprite if one of that name exists
-
- By creating a !Run file with a filetype of &FEB (Obey) it is possible to
- automatically invoke the application by double-clicking on its directory
- icon, and for the Obey command file to do some of the donkey-work involved in
- setting-up the environment for later.
-
-
- *Obey (see also Wimp.Obey)
- -----
-
- Syntax: *Obey <filename> [<parameters>]
-
- The file contains text, where each line is a command to be sent to OS_CLI,
- optionally containing references to the <parameters> given to *Obey (%0 to %9
- reference the parameters, as in an alias. To reference %0 to %9 literally,
- use %%0 to %%9).
-
- The *Obey command copies the name of the file's parent directory into the
- variable Obey$Dir - if the application wishes to remember this value for
- later use, it should use a command of the form:
-
- *Set foo$dir <Obey$Dir>
-
- The parent directory is found by stripping '.<leafname>' from the end of the
- filename given to *Obey, which may contain an element from Run$Path combined
- with the name specified in the original command. For example,
-
- *Set Run$Path adfs::Winnie.Deskworld.-
- *foo xyz
-
- would produce the equivalent of:
-
- *Run adfs::Winnie.Deskworld.-foo xyz
-
- which (if -foo.!Run has filetype &FEB) would produce the equivalent of:
-
- *Obey adfs::Winnie.Deskworld.-foo.!Run xyz
-
- The latter conversion is achieved by a combination of the FileSwitch
- treatment of !Run files, and the setting-up of the filetype &FEB as follows:
-
- *Set Alias$@RunType_FEB Obey %*0
- *Set File$Type_FEB Obey
-
-
- *WimpSlot
- ---------
-
- Syntax: *WimpSlot [-min] <number>[K] [[-max] <number>[K]]
-
- If 'K' (or 'k') follows the <number>, the value is multiplied by 1024.
- <number> can be specified in decimal or &hex, or <base>_<digits>
-
- The WimpSlot command calls Wimp_SlotSize as appropriate to ensure that the
- right amount of memory is available. If sufficient memory is not available,
- the error 'Not enough application memory' is returned.
-
- Since high-level language libraries often respond by crashing completely when
- confronted with insufficient application memory, it is wise for applications
- to safeguard themselves from such an eventuality by checking that sufficient
- memory is available before running the main program.
-
-
- Summary
- -------
-
- In summary, an application directory should contain the following files:
-
- $.-foo ; directory name (ie. application)
- $.-foo.!Boot ; executed by Finder when $ is catalogued
- $.-foo.!Run ; executed by Finder when -foo is 2-clicked
- $.-foo.<something> ; specified in !Run file after '-runfile'
-
- An example !Boot obey file would look something like this:
-
- | > adfs::foodisc.-foo.!Boot
- |
- IconSprites <Obey$Dir>.!Sprites (contains icon '-foo')
- Set Alias$@RunType_ddd /<Obey$Dir> %%*0
-
- where 'ddd' is the filetype of the data files processed by -foo. Note the
- '%%*0' on the last line: this is necessary because of the parameter
- substitution performed by the *obey command.
-
- An example !Run obey file would look something like this:
-
- | > adfs::foodisc.-foo.!Run
- |
- | The comment lines are useful for reading later
-
- Set foo$dir <Obey$Dir>
- WimpSlot -min 200k -max 1000k
- Run "<foo$dir>.fooimage" %*0
-
- Note the quotes around the filename, which are needed if <foo$dir>.fooimage
- is a C program (the C library stuff reads the command line, and would
- otherwise think that the '<' denotes redirection), and the '%*0' at the end,
- which ensures that the parameters given to the *Obey command originally are
- passed through to the main application.
-
-